package com.srxz.mobilepharmacy.repository;

import com.srxz.mobilepharmacy.entity.UserInfo;
import com.srxz.mobilepharmacy.entity.UserInfoPK;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

@Repository
public interface UserInfoRepository extends JpaRepository<UserInfo, UserInfoPK> {
    /**
     * 查询机构药房用户
     * @param name
     * @param aid
     * @return
     */
    @Query("from UserInfo ui where ui.id.name = ?1 and ui.id.aid=?2 and ui.grp like '%药房组%' ")
    UserInfo findUserInfoByName(String name, BigInteger aid);

    @Query("from UserInfo ui where ui.id.aid=?1 and ui.grp like '%药房组%'")
    List<UserInfo> findUserInfoByName(BigInteger aid);
}
